unit uEmpresa;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uPai, DB, StdCtrls, DBCtrls, Buttons, ExtCtrls, ComCtrls,
  Mask, FacDbEdit;

type
  TfEmpresa = class(TfPai)
    OpenDialog1: TOpenDialog;
    FacDBEdit12: TFacDBEdit;
    Label14: TLabel;
    FacDBEdit11: TFacDBEdit;
    Label13: TLabel;
    FacDBEdit8: TFacDBEdit;
    Label8: TLabel;
    FacDBEdit9: TFacDBEdit;
    Label9: TLabel;
    FacDBEdit10: TFacDBEdit;
    Label10: TLabel;
    BitBtn1: TBitBtn;
    Panel4: TPanel;
    FacDBEdit7: TFacDBEdit;
    Label7: TLabel;
    FacDBEdit6: TFacDBEdit;
    Label6: TLabel;
    FacDBEdit5: TFacDBEdit;
    Label4: TLabel;
    FacDBEdit4: TFacDBEdit;
    Label5: TLabel;
    FacDBEdit3: TFacDBEdit;
    Label2: TLabel;
    FacDBEdit1: TFacDBEdit;
    Label1: TLabel;
    SaveDialog1: TSaveDialog;
    DBImage1: TDBImage;
    Panel1: TPanel;
    FacDBEdit15: TFacDBEdit;
    Label16: TLabel;
    FacDBEdit14: TFacDBEdit;
    Label12: TLabel;
    FacDBEdit13: TFacDBEdit;
    Label11: TLabel;
    procedure FormShow(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure DBEdit1Exit(Sender: TObject);
    procedure DBEdit1Click(Sender: TObject);
    procedure FacDBEdit12Exit(Sender: TObject);
    procedure FacDBEdit1Exit(Sender: TObject);
    procedure FacDBEdit1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fEmpresa: TfEmpresa;

implementation

uses UDM;

{$R *.dfm}

procedure TfEmpresa.FormShow(Sender: TObject);
begin
  inherited;

    dm.cds_empresa.Open;
  if dm.cds_Empresa.IsEmpty then
     dm.cds_Empresa.Append
//  else
//     dm.cds_empresa.Edit;
//  FacDBEdit1.SetFocus;
end;

procedure TfEmpresa.BitBtn1Click(Sender: TObject);
begin
  inherited;

    if OpenDialog1.Execute then
    begin
     if DtSrc.State=dsbrowse then
      DM.cds_empresa.Edit;
      DM.cds_empresaLOGOTIPO.LoadFromFile(OpenDialog1.FileName);
    end;

end;

procedure TfEmpresa.DBEdit1Exit(Sender: TObject);
begin
  inherited;

 if dm.cds_empresa.State in [dsInsert, dsEdit] then
  DM.cds_empresaRAZAO_EMPRESA.AsString:=DM.cds_empresaNOME_EMPRESA.AsString;

end;

procedure TfEmpresa.DBEdit1Click(Sender: TObject);
begin
  inherited;

 if dm.cds_empresa.State in [dsInsert, dsEdit] then
  DM.cds_empresaRAZAO_EMPRESA.AsString:=DM.cds_empresaNOME_EMPRESA.AsString;

end;

procedure TfEmpresa.FacDBEdit12Exit(Sender: TObject);
begin
  inherited;
  FacDBEdit13.SetFocus;
end;

procedure TfEmpresa.FacDBEdit1Exit(Sender: TObject);
begin
  inherited;

 if dm.cds_empresa.State in [dsInsert, dsEdit] then
  DM.cds_empresaRAZAO_EMPRESA.AsString:=DM.cds_empresaNOME_EMPRESA.AsString;

end;

procedure TfEmpresa.FacDBEdit1Click(Sender: TObject);
begin
  inherited;
 if dm.cds_empresa.State in [dsInsert, dsEdit] then
  DM.cds_empresaRAZAO_EMPRESA.AsString:=DM.cds_empresaNOME_EMPRESA.AsString;

end;

end.
